<?php if (!defined('THINK_PATH')) exit();?><!DOCTYPE html>
<html>
    <head>
        <title>FeedbackRead</title>
        <meta charset="UTF-8">
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <script src="/Thinkphp/Public/jquery-3.0.0.js"></script>
        <style type="text/css">
            #box{
                width: 1000px;
                text-align: center;
                margin: 0 auto;
                padding: 0;
            }
            #skip{
                text-decoration: none;
            }
            #body{
                text-align:start;
                width: 400px;
                margin: 0 auto;
            }
            .skip{
                text-decoration: none;
            }
            a{
                text-decoration:none;
            }
            #b{
                text-align: start;
                width:800px;
            }
        </style>
    </head>
    <body>
        <div id="box">
            <h2>用户反馈</h2>
            <br/><br/>
            <table id="body">
                <tr>
                    <td>
                       题目： <?php echo $list['title']?>
                    </td>
                </tr>
                <tr>
                    <td>
                       Email： <span id="email"><?php echo $list['email']?></span>
                    </td>
                </tr>
                <tr>
                    <td>
                      用户反馈：<?php echo $list['body']?>
                    </td>
                </tr>
            </table>
            <div><textarea name="reply" id="reply" cols="50" rows="20"></textarea></div>
                <br/><p id="p"></p><br/>
            <button id='feedback'>回复</button>&nbsp;&nbsp;<button id='delete'>删除信息</button>
        </div>
        <script>
            $("#feedback").click(function(){
                var pass = prompt('请输入您的密码');
                var url = "<?php echo U('Admin/Admin/reply?id='.$list['id'])?>";
                var data= {};
                data ['reply'] = $('#reply').val();
                data ['email'] = $('#email').html();
                data ['pass'] = pass;
                var dataType = "json";
                $.post(
                    url,
                    data,
                    function(data){                      
                        if(data.status === 1){
                            alert('回复成功！');
                            location.href="<?php echo U('Admin/Admin/feedback')?>";
                        }
                        if(data.status === 0){
                            $("#p").html("*密码错误！").css("color","red");
                        }
                        if(data.status === 2){
                            $("#p").html("*请先登录！").css("color","red");
                        }
                    },
                    dataType
                );
               return false; 
            }        
        );
            $("#delete").click(function(){ 
                var pass = prompt('请输入您的密码');
                var url = "<?php echo U('Admin/Admin/feedbackdelete?id='.$list['id'])?>";
                var data= {}; 
                data ['pass'] = pass;
                var dataType = "json";
                $.post(
                    url,
                    data,
                    function(data){                      
                        if(data.status === 1){
                            alert('删除成功！');
                            location.href="<?php echo U('Admin/Admin/feedback')?>";
                        }
                        if(data.status === 0){
                            $("#p").html("*密码错误！").css("color","red");
                        }
                        if(data.status === 2){
                            $("#p").html("*请先登录！").css("color","red");
                        }
                    },
                    dataType
                );
               return false;
            }        
        );
        </script>
    </body>
</html>